package activity.personal.qianbao;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.itboye.hutoubenjg.R;

import java.util.Observable;
import java.util.Observer;

import base.BaseActivity;
import base.MyApplcation;
import presenter.SysTemPresenter;
import presenter.UserPresenter;
import util.utls.ByAlert;
import util.utls.IsUtilUid;
import util.utls.OnPasswordInputFinish;
import util.utls.PasswordView;
import util.volley.ResultEntity;


/**
 * 设置支付密码（完成设置）
 */
public class ZhiFuPassSheZhiTwoActivity extends BaseActivity  {
    TextView tvTitle, add_lift_tv;
    ImageView back;
    PasswordView pwdView;// 支付密码
    Intent intent;
    String pass;
    String pwd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_zhi_fu_pass_she_zhi_two);
        tvTitle.setText(R.string.myzhuangdan);
        intent = this.getIntent();
        if (intent != null) {
            pass = intent.getStringExtra("pass");
        }

        final PasswordView pwdView = (PasswordView) findViewById(R.id.pwd_view);

        // 添加密码输入完成的响应
        pwdView.setOnFinishInput(new OnPasswordInputFinish() {
            @Override
            public void inputFinish() {
                // 输入完成后跳转
                // 也就是说——>实现你的交易逻辑什么的在这里写
                 pwd = pwdView.getStrPassword();
                if (pwd.equals(pass)) {
                    Intent intent=new Intent(MyApplcation.ctx,ZhiFuMimaDuanXinaYanZhengActivity.class);
                    intent.putExtra("NewsPwd",pwd);
                    startActivity(intent);


                } else {
                    ByAlert.alert("两次密码不一致");
                }


            }
        });
        //退出登录的广播
        IntentFilter intentFilterExit = new IntentFilter(
                "FINISHSEND");
       registerReceiver(nichengBroadcastReceiver, intentFilterExit);
    }
    BroadcastReceiver nichengBroadcastReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
         finish();
        };
    };
    @Override
    protected void onInit() {

    }

    @Override
    protected void onReadIntent(Bundle bundle) {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.back:
                finish();
                break;

            default:
                break;
        }
    }


}
